In this set of exercises, we clone and work on the GitHub or GitLab repository you have created in the previous session.
In order to do the following exercises, you should have gone through the steps described in the setup information for the workshop. Specifically, you should…
Git via RStudioHTTPS for GitHubFor using GitLab you should also have enabled SSH authentication through creating a RSA key in the Git/SVN options in RStudio.
Git tab. To make extra sure that everything worked, let’s check the Git status of our project via the Terminal in RStudio.
Terminal in RStudio uses via Tools -> Global Options -> Terminal. If you use Windows, you should choose Git Bash (which you should have installed with Git for Windows).
Now that the project is set up and in sync with the remote repository, we can start working on it. Modify the README file (just add, remove or edit a few words). If you want to, you can also edit the R Markdown file(s) in your repository/project.
Git.
Git tab in RStudio and their status will be indicated as modified or untracked.
As a final exercise for this session, let’s do the opposite of pushing and pull changes from the remote repository to your local project. Before we can do this, we first need to make some edits in the remote repository. Go to the website of your remote GitHub/GitLab repository (while being logged in) and edit the README file in the browser (again, just add, remove, or edit a few words). How you edit a file depends on the platform:
On GitHub: You can edit the README via the small pen icon next displayed above the content of your README file.
On GitLab: Click on the name of the file you want to edit (in this case this should be README.md). Next, choose and click “Edit” from the blue dropdown menu shown next to the file name.